      <h1 class="entry-title entry-title-single" itemprop="headline">ALV简介和Fieldcat与Layout相关参数属性</h1>

    <div class="entry-content entry-content-single entry-content-aside" itemprop="text">
      <p><a href="http://www.sapjx.com/alv-fieldcat-and-layout.html#alv" title="1.ALV简介">1.ALV简介</a></p>
<p><a href="http://www.sapjx.com/alv-fieldcat-and-layout.html#attribute" title="">2.ALV报表开发的相关参数及属性</a></p>
<p><a href="http://www.sapjx.com/alv-fieldcat-and-layout.html#layout" title="Layout的相关属性">3.Layout的相关属性</a></p>
<p><a href="http://www.sapjx.com/alv-fieldcat-and-layout.html#fieldcat" title="Fieldcat的相关属性">4.Fieldcat的相关属性</a></p>
<p><a href="http://www.sapjx.com/alv-fieldcat-and-layout.html#fm" title="">5.调用ALV输出函数</a></p>
<p>&nbsp;</p>
<p><strong><a name="alv" id="alv">1.ALV简介</a></strong></p>
<p>ALV(<span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/sap" title="SAP" target="_blank">SAP</a></span> List Viewer) 是<span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/sap" title="SAP" target="_blank">SAP</a></span>常用的屏幕显示列表控件对象，通过传递数据内表方式显示数据；</p>
<p>ALV显示格式分为Grid 和 List两种模式：</p>
<p>Grid模式有栏位选择按钮功能，允许用户直接输出格式，操作更为灵活；</p>
<p>List 模式则固定格式，应用于较严格的标准报表。</p>
<p><span id="more-614"></span><br />
&nbsp;</p>
<p>Grid Mode:</p>
<div id="attachment_615" style="width: 669px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_grid_mode.png" alt="alv_grid_mode" width="659" height="186" class="size-full wp-image-615" /><p class="wp-caption-text">alv_grid_mode</p></div>
<p>&nbsp;</p>
<p>List Mode:</p>
<div id="attachment_616" style="width: 787px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_list_mode.png" alt="alv_list_mode" width="777" height="220" class="size-full wp-image-616" /><p class="wp-caption-text">alv_list_mode</p></div>
<p>&nbsp;</p>
<p>输出ALV的 <span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/function" title="Function" target="_blank">Function</a></span>有两个：<b>REUSE_ALV_GRID_DISPLAY</b> 和 <b>REUSE_ALV_GRID_DISPLAY_LVC</b></p>
<p>两个<span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/function" title="函数" target="_blank">函数</a></span>都可以将数据用ALV的形式显示出来，只是一些小部分有所不同。</p>
<p>&nbsp;</p>
<p><strong><a name="alv" id="attribute">2.ALV报表开发的相关参数及属性</a></strong></p>
<p>2.1 在调用 ALV <span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/function" title="函数" target="_blank">函数</a></span>前，需要引入一个类型池：<strong>SLIS</strong></p>
<p>2.2 Layout和Fieldcat的定义</p>
<p><b>Layout  </b> 主要用于设定 ALV 的输出格式，为 ALV 输出的<i><strong>可选项</strong></i>；</p>
<p><b>Fieldcat</b> 主要用于ALV的结构定义，包括具体的栏位及名称、类型、格式等属性，为 ALV 输出的<i><strong>必选项</strong></i>。</p>
<p>在调用ALV之前，需要先定义Layout 和Fieldcat，他们同属于类型池 <strong>SLIS</strong>：</p>
<p>其中，对于两个ALV函数用到的全局变量定义有所区别：</p>
<p>1) REUSE_ALV_GRID_DISPLAY 函数用到的全局变量：</p>
<pre class="brush: abap;">

DATA: 
   
    wa_fieldcat TYPE slis_fieldcat_alv ,    " 相当于工作区

    i_fieldcat  TYPE slis_t_fieldcat_alv ,  " 存放输出栏位名称的列表

    i_layout    TYPE slis_layout_alv .      " 负责整个ALV的全局属性

</pre>
<p>&nbsp;</p>
<p>2)     REUSE_ALV_GRID_DISPLAY_LVC函数用到的全局变量：</p>
<pre class="brush: abap;">

DATA: 

     wa_fieldcat TYPE lvc_s_fcat ,  " 相当于工作区

     i_fieldcat  TYPE lvc_t_fcat ,  " 存放输出栏位名称的列表

     i_layout    TYPE lvc_s_layo .  " 负责整个ALV的全局属性

</pre>
<p>&nbsp;</p>
<p>可以看出：</p>
<p>REUSE_ALV_GRID_DISPLAY     的Layout 类型为 <strong>slis_layout_alv</strong>, Fieldcat 的类型为 <strong>slis_fieldcat_alv</strong>；</p>
<p>REUSE_ALV_GRID_DISPLAY_LVC 的Layout 类型为 <strong>lvc_s_layo</strong>,      Fieldcat 的类型为 <strong>lvc_s_fcat</strong>；</p>
<p>其中，对于<b style="color:red;">&#8216;SLIS_&#8217;</b>开头的，可以在类型池 SLIS 中查看，<b style="color:red;">&#8216;LVC_&#8217;</b>开头的可以在数据字典（<strong>SE11</strong>）中查看。</p>
<p>&nbsp;</p>
<p>SLIS 类型池中 slis_layout_alv 的定义：</p>
<div id="attachment_618" style="width: 306px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_slis_layout_alv.png" alt="slis_layout_alv" width="296" height="65" class="size-full wp-image-618" /><p class="wp-caption-text">slis_layout_alv</p></div>
<p>SE11中，lvc_s_layo的定义：</p>
<div id="attachment_617" style="width: 738px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_lvc_s_layo.png" alt="lvc_s_layo" width="728" height="218" class="size-full wp-image-617" /><p class="wp-caption-text">lvc_s_layo</p></div>
<p>&nbsp;</p>
<p><strong><a name="alv" id="layout">3 Layout的相关属性</a></strong></p>
<p><strong>3.1 slis_fieldcat_alv 常用具体字段栏位如下:</strong></p>
<p>1) 公共部分</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="141"><b>字段名称</b></td>
<td width="255"><b>描述</b></td>
<td width="208"><b>输入值</b></td>
<td width="189"><b>备注</b></td>
</tr>
<tr>
<td width="141">no_colhead(1)</td>
<td width="255">不显示标题</td>
<td width="208">X-不显示，space-显示</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">no_hotspot(1)</td>
<td width="255">标题不设热点</td>
<td width="208">X-没有，space-有</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141"><b>zebra</b>(1)</td>
<td width="255">使ALV表格按斑马线间隔条码方式显示</td>
<td width="208">X-有，space-没有</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">no_vline(1)</td>
<td width="255">设置列间竖线</td>
<td width="208">X-不显示，space-显示</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">no_hline(1)</td>
<td width="255">设置行间隔线</td>
<td width="208">X-不显示，space-显示</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">cell_merge(1)</td>
<td width="255">设置是否压域复制</td>
<td width="208">X-可复制，space-不可复制</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141"><b>edit</b>(1)<b></b></td>
<td width="255">设置所有单元格可编辑</td>
<td width="208">X-可编辑，space-不可编辑</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">edit_mode(1)</td>
<td width="255">编辑模式</td>
<td width="208">&nbsp;</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141"><b>numc_sum</b>(1)<b></b></td>
<td width="255">设置仅NUMC类型字段进行总计</td>
<td width="208">X-仅Numc类型，</p>
<p>space-不仅Numc类型</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">no_input(1)</td>
<td width="255">不允许输入，用于显示状态</td>
<td width="208">X-不允许，space-允许</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141"><b>f2code</b></td>
<td width="255">设置触发弹出详细信息窗口的功能码</td>
<td width="208">sy-ucomm</td>
<td width="189">&#8216;&amp;ETA’ – 双击</td>
</tr>
<tr>
<td width="141"><b>no_keyfix</b> (1)<b></b></td>
<td width="255">关键字不固定，可以随滚动条滚动</td>
<td width="208">X-不固定，space-固定</td>
<td width="189">&nbsp;</td>
</tr>
<tr>
<td width="141">expand_all (1)</td>
<td width="255">展开所有的node</td>
<td width="208">&nbsp;</td>
<td width="189">对hierarchy ALV函数而言</td>
</tr>
<tr>
<td width="141">no_author (1)</td>
<td width="255">设置是否需要系统标准权限检查</td>
<td width="208">X-不需要，space-需要</td>
<td width="189">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>2) ALV菜单栏</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="144"><b>描述</b></td>
<td width="165"><b>输入值</b></td>
<td width="182"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">def_status (1)</td>
<td valign="top" width="144">默认菜单状态</td>
<td valign="top" width="165">A显示，space不显示</td>
<td valign="top" width="182">‘A’ – 为显示所有标准菜单</td>
</tr>
<tr>
<td valign="top" width="144">item_text (20)</td>
<td valign="top" width="144">菜单按钮文本</td>
<td valign="top" width="165">&nbsp;</td>
<td valign="top" width="182">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">countfname (1)</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="165">lvc_fname</td>
<td valign="top" width="182">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>3) 显示选项</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="215"><b>描述</b></td>
<td width="180"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144"><b>colwidth_optimize</b>(1)<b></b></td>
<td valign="top" width="215">优化列宽设置</td>
<td valign="top" width="180">X-优化</td>
<td valign="top" width="144">默认：space</td>
</tr>
<tr>
<td valign="top" width="144">no_min_linesize(1)</td>
<td valign="top" width="215">设置不允许最小宽度</td>
<td valign="top" width="180">X-不允许，space-允许</td>
<td valign="top" width="144">默认：space</td>
</tr>
<tr>
<td valign="top" width="144">min_linesize</td>
<td valign="top" width="215">ALV列表的最小宽度</td>
<td valign="top" width="180">sy-linsz，取值10到250</td>
<td valign="top" width="144">可选参数</td>
</tr>
<tr>
<td valign="top" width="144">max_linesize</td>
<td valign="top" width="215">ALV列表的最大宽度</td>
<td valign="top" width="180">sy-linsz，可取值80-1020</td>
<td valign="top" width="144">默认值250</td>
</tr>
<tr>
<td valign="top" width="144">window_titlebar</td>
<td valign="top" width="215">窗口标题</td>
<td valign="top" width="180">sy-title</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">no_uline_hs(1)</td>
<td valign="top" width="215">输出ALV表不显示水平格线</td>
<td valign="top" width="180">X-不显示，space-显示</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>4) 红绿灯显示异常</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="309"><b>描述</b></td>
<td width="208"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">lights_fieldname</td>
<td valign="top" width="309">输出内表中定义的字段名，该字段用来显示状态灯</td>
<td valign="top" width="208">1：red，2：yellow，3：green</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">lights_tabname</td>
<td valign="top" width="309">输出字段的参考内表名称</td>
<td valign="top" width="208">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">lights_rollname</td>
<td valign="top" width="309">数据元素的名称，在灯字段按F1触发</td>
<td valign="top" width="208">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">lights_condense</td>
<td valign="top" width="309">对输出的内表分类汇总的时候，小计行显示状态灯</td>
<td valign="top" width="208">X</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>5) 汇总合计</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="146"><b>字段名称</b></td>
<td width="241"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="146">no_sumchoice (1)</td>
<td valign="top" width="241">不能进行选择总计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">no_totalline (1)</td>
<td valign="top" width="241">不能总计，但可以小计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">no_subchoice (1)</td>
<td valign="top" width="241">不能选择小计，但可以总计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">no_subtotals (1)</td>
<td valign="top" width="241">不能小计，但可以总计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">no_unit_splitting</td>
<td valign="top" width="241">有单位字段，不进行总计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">totals_before_items</td>
<td valign="top" width="241">总行将会显示在最前面</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">totals_only (1)</td>
<td valign="top" width="241">仅显示合计</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">totals_text (60)</td>
<td valign="top" width="241">合计，第一列显示的文本</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="146">subtotals_text      (60)</td>
<td valign="top" width="241">总计和小计行，第一列显示的文本</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>6) 交互</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="170"><b>字段名称</b></td>
<td width="243"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="170">box_fieldname</td>
<td valign="top" width="243">设置ALV表格是否显示选择按钮栏位</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">box_tabname</td>
<td valign="top" width="243">box_fieldname 参考内表名称</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">box_rollname</td>
<td valign="top" width="243">下拉框按钮名称</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">expand_fieldname</td>
<td valign="top" width="243">’展开’字段名称</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">hotspot_fieldname</td>
<td valign="top" width="243">热点字段</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">confirmation_prompt</td>
<td valign="top" width="243">退出ALV列表的确认对话框</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170"><b>key_hotspot</b> (1)</td>
<td valign="top" width="243">关键字段作为热点</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">flexible_key (1)</td>
<td valign="top" width="243">关键字段可以移动</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">group_buttons (1)</td>
<td valign="top" width="243">COL1 &#8211; COL5 按钮组</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">get_selinfos (1)</td>
<td valign="top" width="243">获取选择屏幕</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">group_change_edit (1)</td>
<td valign="top" width="243">设置用户新的按钮组</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="170">no_scrolling(1)</td>
<td valign="top" width="243">滚动条无效，清单不随其滚动</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">仅list_alv有效</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>7) 明细窗口</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="147"><b>字段名称</b></td>
<td width="192"><b>描述</b></td>
<td width="189"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="147">detail_popup (1)</td>
<td valign="top" width="192">行项目明细弹窗形式</td>
<td valign="top" width="189">X-显示，space-不显示</td>
<td valign="top" width="144">对list_alv有效</td>
</tr>
<tr>
<td valign="top" width="147">detail_initial_lines(1)</td>
<td valign="top" width="192">明细中同时显示初始化行</td>
<td valign="top" width="189">X-同时显示，space-不显示</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="147">detail_titlebar</td>
<td valign="top" width="192">明细窗口标题文本</td>
<td valign="top" width="189">sy-title</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>8) 显示变式</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="144"><b>描述</b></td>
<td width="165"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">header_text</td>
<td valign="top" width="144">表头按钮</td>
<td valign="top" width="165">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">default_item (1)</td>
<td valign="top" width="144">列表明细作为默认值</td>
<td valign="top" width="165">X-激活，space-不激活</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>9) 颜色</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="253"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="263"><b>备注</b></td>
</tr>
<tr>
<td width="144">info_fieldname</td>
<td width="253">用于设置ALV输出报表每一行的颜色，</p>
<p>其参数为输出内表的栏位名称</td>
<td width="144">C000~C999</td>
<td width="263">倘若其数据输出内表名为LT_OUT，则需要在改内表增加一个栏位“COLOR”，并为内表每行赋值，</p>
<p>LT_OUT-COLOR = ‘C500’</td>
</tr>
<tr>
<td width="144">coltab_fieldname</td>
<td width="253">颜色值</td>
<td width="144">&nbsp;</td>
<td width="263">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>10) 其他</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="253"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">list_append</td>
<td valign="top" width="253">设置是否Call屏幕</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">xifunckey</td>
<td valign="top" width="253">eXtended interaction(SAPQuery)</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">xidirect</td>
<td valign="top" width="253">eXtended INTeraction(SAPQuery)</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">dtc_layout</td>
<td valign="top" width="253">设置Tabstip的布局格式配置</td>
<td valign="top" width="144">DTC_S_LAYO</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">allow_switch_to_list</td>
<td valign="top" width="253">设置从Grid模式转换为List模式</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>3.2 lvc_s_layo常用具体字段栏位如下：</strong></p>
<p>1) 布局控制（ALV_S_LAYO）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="271"><b>描述</b></td>
<td width="198"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144"><b>ZEBRA</b>(1)</td>
<td valign="top" width="271">使ALV表格按斑马线间隔条码方式显示</td>
<td valign="top" width="198">X-有，space-没有</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144"><b>EDIT</b>(1)</td>
<td valign="top" width="271">准备编辑</td>
<td valign="top" width="198">X-可编辑，space-不可编辑</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">EDIT_MODE(1)</td>
<td valign="top" width="271">编辑模式</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_KEYFIX(1)</td>
<td valign="top" width="271">关键字不固定，可以随滚动条滚动</td>
<td valign="top" width="198">X-不固定，space-固定</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">FRONTEND(1)</td>
<td valign="top" width="271">&nbsp;</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144"><b>LANGUAGE</b></td>
<td valign="top" width="271">语言标识符</td>
<td valign="top" width="198">LANG</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">SMALLTITLE(1)</td>
<td valign="top" width="271">标题大小</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_HGRIDLN(1)</td>
<td valign="top" width="271">是否隐藏水平网格线</td>
<td valign="top" width="198">X-不显示，space-显示</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_VGRIDLN(1)</td>
<td valign="top" width="271">是否隐藏垂直网格线</td>
<td valign="top" width="198">X-不显示，space-显示</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_HEADERS(1)</td>
<td valign="top" width="271">隐藏列抬头</td>
<td valign="top" width="198">X-不显示，space-显示</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_MERGING(1)</td>
<td valign="top" width="271">禁用单元格合并</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144"><b>CWIDTH_OPT</b>(1)</td>
<td valign="top" width="271">自动优化列宽</td>
<td valign="top" width="198">X-优化，space-不自动优化</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">TOTALS_BEF(1)</td>
<td valign="top" width="271">在个别记录前总计输出</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_TOTARR(1)</td>
<td valign="top" width="271">汇总行前显示箭头表示汇总</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_TOTEXP(1)</td>
<td valign="top" width="271">只显示小计，不显示总计</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_F4(1)</td>
<td valign="top" width="271">屏蔽F4搜索帮助</td>
<td valign="top" width="198">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">COUNTFNAME</td>
<td valign="top" width="271">内部表字段的字段名称</td>
<td valign="top" width="198">LVC_FNAME</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>2) 一般显示选项（LVC_S_L001）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="243"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">STYLEFNAME</td>
<td valign="top" width="243">用来传输格表，以便把各显示为按钮</td>
<td valign="top" width="144">LVC_FNAME</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>3) 网格定制（LVC_S_L002）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="243"><b>描述</b></td>
<td width="213"><b>输入值</b></td>
<td width="201"><b>备注</b></td>
</tr>
<tr>
<td width="144">NO_ROWMARK</td>
<td width="243">禁用行选择</td>
<td width="213">&nbsp;</td>
<td width="201">&nbsp;</td>
</tr>
<tr>
<td width="144">NO_TOOLBAR</td>
<td width="243">隐藏工具栏</td>
<td width="213">&nbsp;</td>
<td width="201">&nbsp;</td>
</tr>
<tr>
<td width="144">GRID_TITLE</td>
<td width="243">标题栏文本</td>
<td width="213">&nbsp;</td>
<td width="201">&nbsp;</td>
</tr>
<tr>
<td width="144"><b>SEL_MODE</b>(1)<b></b></td>
<td width="243">选择模式</td>
<td width="213">A-选择按钮，space-空白</td>
<td width="201">&#8220;A&#8221;在最左端有选择按钮</td>
</tr>
<tr>
<td width="144">BOX_FNAME</td>
<td width="243">内部表字段的字段名称</td>
<td width="213">&nbsp;</td>
<td width="201">&nbsp;</td>
</tr>
<tr>
<td width="144">SGL_CLK_HD</td>
<td width="243">第一次点击列的头的时候升序排列，</p>
<p>第二次点击的时候降序排列</td>
<td width="213">&nbsp;</td>
<td width="201">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>4) 总计选项（LVC_S_L003）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="186"><b>描述</b></td>
<td width="170"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">NO_TOTLINE(1)</td>
<td valign="top" width="186">不输出总计行</td>
<td valign="top" width="170">X-不输出，space-输出</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NUMC_TOTAL(1)</td>
<td valign="top" width="186">禁止 NUMC 字段总计</td>
<td valign="top" width="170">X-禁止，space-不禁止</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_UTSPLIT(1)</td>
<td valign="top" width="186">按单元拆分总计行</td>
<td valign="top" width="170">X-不拆分，space-拆分</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>5) 例外（LVC_S_L004）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="309"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">EXCP_FNAME</td>
<td valign="top" width="309">Field name with exception coding</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">EXCP_ROLLN</td>
<td valign="top" width="309">Data element for exception documentation</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">EXCP_CONDS(1)</td>
<td valign="top" width="309">Aggregate exceptions</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">EXCP_LED(1)</td>
<td valign="top" width="309">Exception as LED</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">EXCP_GROUP(1)</td>
<td valign="top" width="309">Exception Group</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>6) 交互控制（LVC_S_L005）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="177"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">DETAILINIT</td>
<td valign="top" width="177">在细节屏幕显示初始值</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">DETAILTITL</td>
<td valign="top" width="177">细节屏幕的标题栏</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">KEYHOT</td>
<td valign="top" width="177">关键列作为热点</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">NO_AUTHOR</td>
<td valign="top" width="177">不执行 ALV 标准授权检查</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">XIFUNCKEY</td>
<td valign="top" width="177">附加功能名</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">XIDIRECT</td>
<td valign="top" width="177">一般标记</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="177">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>7) 拖&amp;放控制设置（LVC_S_DD01）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="177"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">S_DRAGDROP</td>
<td valign="top" width="177">拖&amp;放控制设置结构</td>
<td valign="top" width="144">LVC_S_DD01</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>8) 颜色（LVC_S_L006）</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="144"><b>字段名称</b></td>
<td width="253"><b>描述</b></td>
<td width="144"><b>输入值</b></td>
<td width="144"><b>备注</b></td>
</tr>
<tr>
<td valign="top" width="144">INFO_FNAME</td>
<td valign="top" width="253">带有简单行彩色代码的字段名称</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
<tr>
<td valign="top" width="144">CTAB_FNAME</td>
<td valign="top" width="253">代表颜色信息的字段名</td>
<td valign="top" width="144">&nbsp;</td>
<td valign="top" width="144">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong><a name="alv" id="fieldcat">4 Fieldcat的相关属性</a></strong></p>
<p>和Layout一样，REUSE_ALV_GRID_DISPLAY 函数中的 Fieldcat 结构: <b>slis_t_fieldcat_alv</b> 可在 SLIS 类型池中找到；</p>
<p>REUSE_ALV_GRID_DISPLAY_LVC函数中的 Fieldcat 结构:<b> lvc_s_fcat</b> 可在 SE11 中查看。</p>
<p>两者大同小异，常用具体字段栏位如下:</p>
<p>&nbsp;</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="170"><b>字段名称</b></td>
<td width="357"><b>描述</b></td>
<td width="198"><b>输入值</b></td>
<td width="196"><b>备注</b></td>
</tr>
<tr>
<td width="170">row_pos</td>
<td width="357">输出行位置</td>
<td width="198">1….n</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">col_pos</td>
<td width="357">输出列位置</td>
<td width="198">1….n</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>fieldname</b></td>
<td width="357">字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>tabname</b></td>
<td width="357">fieldname字段对应的内表名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">currency</td>
<td width="357">货币单位</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>cfieldname</b></td>
<td width="357">当前输出内表中的货币单位字段的字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>ctabname</b></td>
<td width="357">Cfieldname字段值对应的内表名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">ifieldname</td>
<td width="357">&nbsp;</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">quantity</td>
<td width="357">计量单位</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>qfieldname</b></td>
<td width="357">参考计量单位的字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>qtabname</b></td>
<td width="357">Qfieldname  对应的输出内表名</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>round</b></td>
<td width="357">四舍五入保留位数</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">exponent</td>
<td width="357">流动表示的指数</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>key</b>(1)</td>
<td width="357">将栏位设置为Key值</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">icon(1)</td>
<td width="357">将定义栏位以ICON的形式显示</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">symbol(1)</td>
<td width="357">作为Symbol符号输出，</p>
<p>在ALV输出内表中的字段值可以是<span class='wp_keywordlink'><a href="http://www.sapjx.com/tag/sap-abap" title="ABAP" target="_blank">ABAP</a></span>名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>checkbox</b>(1)</td>
<td width="357">作为复选框输出</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>just</b>(1)</td>
<td width="357">定义栏位对齐方式</td>
<td width="198">(R)Right (L)Left (C)Center</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">lzero(1)</td>
<td width="357">输出前置零</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>no_sign</b>(1)</td>
<td width="357">不输出正负号+、-</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>no_zero</b>(1)</td>
<td width="357">如果取值为零，则为空，既不输出零</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">no_convext(1)</td>
<td width="357">&nbsp;</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">edit_mask</td>
<td width="357">输出编辑掩码, 同write语句中的edit mas格式是一样的</td>
<td width="198">&nbsp;</td>
<td width="196">一般用来格式化时间和日期等</td>
</tr>
<tr>
<td width="170">emphasize(4)</td>
<td width="357">设置栏位的颜色</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>fix_column</b>(1)</td>
<td width="357">固定列</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">do_sum(1)</td>
<td width="357">对当前列输出时自动求和</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>no_out</b>(1)</td>
<td width="357">当前列隐藏输出</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">tech(1)</td>
<td width="357">技术字段，设置’X’后，该字段不会显示，</p>
<p>也不能输出，如同MANDT字段一样的效果</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">outputlen</td>
<td width="357">列的字符宽度</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">offset</td>
<td width="357">偏移量</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">seltext_l / scrtext_l</td>
<td width="357">长文本</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">seltext_m / scrtext_m</td>
<td width="357">中文本</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">seltext_s / scrtext_s</td>
<td width="357">短文本</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">ddictxt(1)</td>
<td width="357">列标题描述格式</td>
<td width="198">(S)hort (M)iddle (L)ong</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">rollname</td>
<td width="357">&nbsp;</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">datatype</td>
<td width="357">数据类型</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">inttype</td>
<td width="357">整型</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">intlen</td>
<td width="357">整型长度</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">lowercase</td>
<td width="357">是否允许小写字母</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">decfloat_style</td>
<td width="357">浮点格式</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">ref_fieldname</td>
<td width="357">参考字段名称，配合ref_tabname一起使用，</p>
<p>一般用来使单元格生成F4帮助</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">ref_tabname</td>
<td width="357">参考表名称，配合ref_fieldname使用</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">roundfieldname</td>
<td width="357">四舍五入字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">roundtabname</td>
<td width="357">四舍五入内表名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">decimalsfieldname</td>
<td width="357">小数点字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">decimalstabname</td>
<td width="357">小数点内表名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">decimals_out(6)</td>
<td width="357">控制小数点的位数</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170"><b>text_fieldname</b></td>
<td width="357">文本字段名称</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">reptext_ddic</td>
<td width="357">与数据元素的主标题类似</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">ddic_outputlen</td>
<td width="357">数据字典输出长度</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">key_sel(1)</td>
<td width="357">这个参数只和设置了Key的字段相关，和Key一起使用</p>
<p>可以交互式的隐藏设置为Key的字段(alv_list有效)</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">no_sum(1)</td>
<td width="357">不自动汇总</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">sp_group(4)</td>
<td width="357">分组需求</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">reprep(1)</td>
<td width="357">selection for rep/rep</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">input(1)</td>
<td width="357">输入</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">edit(1)</td>
<td width="357">编辑</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
<tr>
<td width="170">hotspot(1)</td>
<td width="357">设置栏位是否有热点（热点栏位显示有下划线）</td>
<td width="198">&nbsp;</td>
<td width="196">&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong><a name="alv" id="fm">5 调用ALV输出函数</a></strong></p>
<p>使用ALV输出，可以直接参考数据字典中的现有透明表，也可以自定义Fieldcat来输出字段；</p>
<p>如若使用数据字典中的透明表或视图时，需要调用REUSE_ALV_FIELDCATALOG_MERGE 函数来对相应的Fieldcat 进行匹配；</p>
<p>另外，必须保证该结构或内表中的每个字段都参考数据字典中的Data Element，否则无法获取字段的相关信息.</p>
<p>以REUSE_ALV_GRID_DISPLAY 函数为例：</p>
<pre class="brush: abap;">

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_interface_check             = ' '
      i_bypassing_buffer            = ' '
      i_buffer_active               = ' '
      i_callback_program            = gv_repid            "程序名称
      i_callback_pf_status_set      = 'FRM_SET_GUI'       "定义触发工具栏定义的子程序
      i_callback_user_command       = 'FRM_USER_COMMAND'  "单击alv工具栏按钮或双击行项目时触发所定义的子程序
      i_callback_top_of_page        = ' '  
      i_callback_html_top_of_page   = ' '  
      i_callback_html_end_of_list   = ' '
      i_structure_name              =
      i_background_id               = ' '
      i_grid_title                  = 'ALV输出'      "ALV名称
      i_grid_settings               =
      is_layout                     = gt_layout      "程序所定义的layout名称
      it_fieldcat                   = gt_fieldcat[]  "定义fieldcat数据
      it_excluding                  =
      it_special_groups             =
      it_sort                       = gt_sort[]
      it_filter                     =
      is_sel_hide                   =
      i_default                     = 'X'
      i_save                        = 'X'
      is_variant                    =
      it_events                     = gt_event[]
      it_event_exit                 =
      is_print                      =
      is_reprep_id                  =
      i_screen_start_column         = '0'
      i_screen_start_line           = '0'
      i_screen_end_column           = '0'
      i_screen_end_line             = '0'
      i_html_height_top             = '0'
      i_html_height_end             = '0'
      it_alv_graphics               =
      it_hyperlink                  =
      it_add_fieldcat               =
      it_except_qinfo               =
      ir_salv_fullscreen_adapter    =
    IMPORTING
      e_exit_caused_by_caller       =
      es_exit_caused_by_user        =
    TABLES
       t_outtab                      = gt_print
      EXCEPTIONS
       program_error                 = 1
       OTHERS                        = 2.
</pre>
<p>&nbsp;</p>
<p>下面看看两个函数各自输出的方式与操作;</p>
<p>1)    REUSE_ALV_GRID_DISPLAY 函数:</p>
<pre class="brush: abap;">

REPORT  ztest_jx_alv.

TYPES: slis.

TYPES: BEGIN OF ty_s_matnr,
  matnr TYPE mara-matnr,
  END OF ty_s_matnr.

DATA: i_tab TYPE STANDARD TABLE OF ty_s_matnr.

SELECT matnr
  FROM mara
  INTO CORRESPONDING FIELDS OF TABLE i_tab
  UP TO 20 ROWS.

DATA: wa_fieldcat TYPE slis_fieldcat_alv ,    " 相当于工作区
      i_fieldcat  TYPE slis_t_fieldcat_alv ,  " 存放列名的列表
      i_layout    TYPE slis_layout_alv .      " 负责整个ALV的全局属性

DATA: lv_pos TYPE p.

wa_fieldcat-qtabname    =
wa_fieldcat-ctabname    =
wa_fieldcat-tabname     = 'I_TAB'.
wa_fieldcat-fieldname   = 'MATNR'.        " 需要输出的内表的字段名
wa_fieldcat-seltext_l   = 'Material NO.'. " 字段的描述-长字段标签
wa_fieldcat-seltext_m   = 'Material NO.'. " 字段描述-中字段标签
wa_fieldcat-seltext_s   = 'Material NO.'. " 字段描述-短字段标签
wa_fieldcat-fix_column  = 'X' .           " 是否是固定列
APPEND wa_fieldcat TO i_fieldcat.
CLEAR  wa_fieldcat.


i_layout-zebra                  = 'X' .          " 使ALV界面呈现颜色交替
i_layout-colwidth_optimize      = 'X' .          " 自动优化列宽
i_layout-detail_initial_lines   = 'X' .          " 是否出现细节屏幕
i_layout-detail_titlebar        = '详细内容' .   " 细节屏幕标题


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid          " 当前程序
    is_layout          = i_layout          " 属性内表
    it_fieldcat        = i_fieldcat[]      " 列明内表
    i_save             = 'X'               " 是否保存布局
  TABLES
    t_outtab           = i_tab
  EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.

</pre>
<p>&nbsp;</p>
<p>输出结果：</p>
<div id="attachment_621" style="width: 413px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_reuse_alv_grid_display_result.png" alt="reuse_alv_grid_display" width="403" height="479" class="size-full wp-image-621" /><p class="wp-caption-text">reuse_alv_grid_display</p></div>
<p>&nbsp;</p>
<p>2)    REUSE_ALV_GRID_DISPLAY_LVC 函数</p>
<pre class="brush: abap;">

REPORT  ztest_jx_alv_lvc.

* 引入类型池
TYPES: slis.

TYPES: BEGIN OF ty_s_matnr,
  matnr TYPE mara-matnr,
  END OF ty_s_matnr.

DATA: i_tab TYPE STANDARD TABLE OF ty_s_matnr .

SELECT matnr
  FROM mara
  INTO CORRESPONDING FIELDS OF TABLE i_tab
  UP TO 20 ROWS.

DATA: wa_fieldcat_lvc   TYPE lvc_s_fcat ,       " 相当于工作区
      i_fieldcat_lvc    TYPE lvc_t_fcat ,       " 存放列名的列表
      i_layout_lvc      TYPE lvc_s_layo .       " 负责整个ALV的全局属性

wa_fieldcat_lvc-tabname       = 'I_TAB'.
wa_fieldcat_lvc-fieldname     = 'MATNR'.          " 需要输出的内表的字段名
wa_fieldcat_lvc-scrtext_l     = 'Material NO.'.   " 字段的描述-长字段标签
wa_fieldcat_lvc-scrtext_m     = 'Material NO.'.   " 字段描述-中字段标签
wa_fieldcat_lvc-scrtext_s     = 'Material NO.'.   " 字段描述-短字段标签
wa_fieldcat_lvc-fix_column    = 'X' .             " 是否是固定列
APPEND wa_fieldcat_lvc TO i_fieldcat_lvc .
CLEAR  wa_fieldcat_lvc.

i_layout_lvc-zebra        = 'X' .          " 使ALV界面呈现颜色交替
i_layout_lvc-sel_mode     = 'A' .          " 选择模式，"A"在最左端有选择按钮
i_layout_lvc-cwidth_opt   = 'X' .          " 自动优化列宽
i_layout_lvc-detailinit   = 'X' .          " 是否出现细节屏幕
i_layout_lvc-detailtitl   = '详细内容' .   " 细节屏幕标题


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
  EXPORTING
    i_callback_program = sy-repid          " 当前程序
    is_layout_lvc      = i_layout_lvc      " 属性内表
    it_fieldcat_lvc    = i_fieldcat_lvc[]  " 列明内表
    i_save             = 'X'               " 是否保存布局
  TABLES
    t_outtab           = i_tab             " 数据内表
  EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.

</pre>
<p>&nbsp;</p>
<p>输出结果：</p>
<div id="attachment_620" style="width: 408px" class="wp-caption alignnone"><img src="http://www.sapjx.com/wp-content/uploads/2014/08/alv_reuse_alv_grid_display_lvc_result.png" alt="reuse_alv_grid_display_lvc" width="398" height="479" class="size-full wp-image-620" /><p class="wp-caption-text">reuse_alv_grid_display_lvc</p></div>
<p>&nbsp;</p>
